<template>
  <!-- 底部部分 -->
  <footer class="footer">
      <span class="todo-count">剩余<strong>{{ list.length }}</strong></span>
      <!-- 冒泡传递值 -->
      <ul class="filters" @click="$emit('choseState',type)">
        <li>
          <a @click="type='all'"  :class="{selected : list.isDone}" href="#/">全部</a>
        </li>
        <li>
          <a @click="type='no'"  :class="{selected : list.isDone}"  href="#/active">进行中</a>
        </li>
        <li>
          <a @click="type='yes'"  :class="{selected : list.isDone}"  href="#/completed">已完成</a>
        </li>
      </ul>
      <button @click="$emit('clearState')" v-show="showClear" class="clear-completed">清除已完成</button>
    </footer>
</template>

<script>
export default {
  props:{
    list:{
      require:true,
      type:Array
    }
  },
  data(){
    return{
      //初始值为all  取值范围为 all / yes /no
      type:'all'
    }
  },
  computed:{
    showClear(){
      return this.list.some(item => item.isDone)
    }
  }
}
</script>

<style>

</style>